<?php

/**
 * AbetStudent filter form base class.
 *
 * @package    sfproject
 * @subpackage filter
 * @author     Your name here
 */
abstract class BaseAbetStudentFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'instructor_Code' => new sfWidgetFormPropelChoice(array('model' => 'AbetInstructor', 'add_empty' => true, 'key_method' => 'getCode')),
      'department_Code' => new sfWidgetFormPropelChoice(array('model' => 'AbetDepartment', 'add_empty' => true, 'key_method' => 'getCode')),
      'code'            => new sfWidgetFormFilterInput(),
      'name'            => new sfWidgetFormFilterInput(),
      'password'        => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'start_Date'      => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'level_Number'    => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'birth_Date'      => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'sex'             => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'degree'          => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'gpa'             => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'email'           => new sfWidgetFormFilterInput(),
      'mobile'          => new sfWidgetFormFilterInput(),
      'created_at'      => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
    ));

    $this->setValidators(array(
      'instructor_Code' => new sfValidatorPropelChoice(array('required' => false, 'model' => 'AbetInstructor', 'column' => 'code')),
      'department_Code' => new sfValidatorPropelChoice(array('required' => false, 'model' => 'AbetDepartment', 'column' => 'code')),
      'code'            => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'name'            => new sfValidatorPass(array('required' => false)),
      'password'        => new sfValidatorPass(array('required' => false)),
      'start_Date'      => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'level_Number'    => new sfValidatorPass(array('required' => false)),
      'birth_Date'      => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'sex'             => new sfValidatorPass(array('required' => false)),
      'degree'          => new sfValidatorPass(array('required' => false)),
      'gpa'             => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'email'           => new sfValidatorPass(array('required' => false)),
      'mobile'          => new sfValidatorPass(array('required' => false)),
      'created_at'      => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
    ));

    $this->widgetSchema->setNameFormat('abet_student_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'AbetStudent';
  }

  public function getFields()
  {
    return array(
      'id'              => 'Number',
      'instructor_Code' => 'ForeignKey',
      'department_Code' => 'ForeignKey',
      'code'            => 'Number',
      'name'            => 'Text',
      'password'        => 'Text',
      'start_Date'      => 'Date',
      'level_Number'    => 'Text',
      'birth_Date'      => 'Number',
      'sex'             => 'Text',
      'degree'          => 'Text',
      'gpa'             => 'Number',
      'email'           => 'Text',
      'mobile'          => 'Text',
      'created_at'      => 'Date',
    );
  }
}
